<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('终端划拨')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-record-add" enctype="multipart/form-data">
        <h4 class="form-header h4" >划拨目标信息</h4>
        <div class="row">

            <div class="form-group">
                <label class="col-sm-3 control-label">活动编号：</label>
                <div class="col-sm-8">
                    <input name="laterActivity" onclick="selectAct()" readonly id="actId" type="text" class="form-control">
                    <i class="fa fa-search" style="margin-top: -22px;margin-right:3px;float:right;"></i>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label is-required">活动名称：</label>
                <div class="col-sm-8">
                    <input name="actName" class="form-control" id="actName" type="text" required readonly>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label is-required">SN编号：</label>
                <div class="col-sm-8">
                    <span class="btn btn-white btn-file">
                        <input id="files" type="file" name="file"  accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />
                    </span>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label  is-required">SN所属服务商：</label>
                <div class="col-sm-8">
                    <input name="agentTarNum" onclick="selectAgent()" readonly id="xagentName_Num" type="text" class="form-control" required>
                    <i class="fa fa-search" style="margin-top: -22px;margin-right:3px;float:right;"></i>
                </div>
            </div>
            <input type="hidden" name="posType" id="posType">
            <input type="hidden" name="agent" id="xagentNum">
        </div>



    </form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var prefix = ctx + "formalPos/formalPos"
    $("#form-record-add").validate({
        focusCleanup: true

    });

    function submitHandler() {
        if ($.validate.form()) {
            var formData = new FormData();
            formData.append("laterActivity",$("[name='laterActivity']").val());     //活动id
            formData.append("posType",$("[name='posType']").val());   //活动终端类型
            formData.append("agent",$("[name='agent']").val());   //所属服务商
            formData.append("file", $("[name = 'file']")[0].files[0]);  //SN文件
            $.ajax({
                url : prefix + "/addUpdateActivity",
                type: 'POST',
                data: formData,
                cache: false,
                contentType: false,
                processData: false,
                success : function(result) {
                    $.modal.confirm(result.msg,function() {
                        $.modal.close()
                    })
                },
                error : function(result) {
                    $.modal.alertError(result.msg);
                }
            });
        }
    }

    function selectAct() {
        var url =ctx+ "terminal/record/selectActList";
        $.modal.open("选择活动" , url, '700');
    }
    function selectAgent() {
        var url =ctx + "terminal/record" + "/selectAgentInfo";
        $.modal.open("选择服务商" , url, '800',"400");
    }
</script>
</body>
</html>
v